package com.lingx.web.core;

import java.util.UUID;

import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

public class MyAnnotationBeanNameGenerator  implements BeanNameGenerator {
	private AnnotationBeanNameGenerator obj =new AnnotationBeanNameGenerator();
    @Override
    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
    	String name=obj.generateBeanName(definition, registry);
    	if(name.length()<5) {
    		name=determineBeanNameFromAnnotation(null);
    	}
        return name;


}
    public String determineBeanNameFromAnnotation(AnnotatedBeanDefinition obj) {
    	return UUID.randomUUID().toString();
    }
}
